package cn.tedu.submarine;

import javax.swing.*;
import java.applet.AudioClip;
import java.io.File;
import java.net.MalformedURLException;

public class Images {
    public static ImageIcon[] minesubm;//机器人（水雷潜艇）图
    public static ImageIcon[] obsersubm;//狮子（侦查潜艇）图
    public static ImageIcon[] torpesubm;//哥布林（鱼雷潜艇）图
    public static ImageIcon bomb;//激光弹（炸弹）图
    public static ImageIcon mine;//黑激光弹（水雷）图
    public static ImageIcon gameover;//游戏结束图
    public static ImageIcon[] sea;//背景图
    public static ImageIcon[] bossleft;//boss左图
    public static ImageIcon[] bossright;//boss右图
    public static ImageIcon[] rewardsubm;//天使（奖励战舰）图
    public static ImageIcon[] coin;//金币图
    public static ImageIcon bossbomb;//boss子弹1图
    public static ImageIcon[] bossbombnum;//boss子弹2图
    public static ImageIcon[] witchone;//魔女1（战舰）图
    public static ImageIcon[] witchtwo;//魔女2（战舰）图
    public static ImageIcon[] ult;//大招图
    public static ImageIcon[] boommap;//爆炸图
    public static ImageIcon[] bossboom;//boss爆炸图
    public static ImageIcon[] shieldwitch;//护盾魔女图
    public static ImageIcon[] shield;//护盾图
    public static ImageIcon bosshp;//boss血条图


    public static AudioClip coinsound;//金币声
    public static AudioClip bgm;//背景声
    public static AudioClip bombsound;//魔女放激光弹声
    public static AudioClip bbsound;//boss放子弹声
    public static AudioClip boom;//爆炸声
    public static AudioClip gameoversound;//游戏结束声



    static {
        bomb = new ImageIcon("img/bomb.png");
        mine = new ImageIcon("img/mine.png");
        gameover = new ImageIcon("img/gameover.png");
        bosshp = new ImageIcon("img/bosshp.png");
        minesubm = new ImageIcon[8];//画机器人（水雷潜艇）
        for (int i = 0; i <minesubm.length ; i++) {
            minesubm[i] = new ImageIcon("img/minesubm/minesubm"+i+".png");
        }
        obsersubm = new ImageIcon[5];//画狮子（侦查潜艇）
        for (int i = 0; i <obsersubm.length ; i++) {
            obsersubm[i] = new ImageIcon("img/obsersubm/obsersubm"+i+".png");
        }
        torpesubm = new ImageIcon[4];//画哥布林（鱼雷潜艇）
        for (int i = 0; i <torpesubm.length ; i++) {
            torpesubm[i] = new ImageIcon("img/torpesubm/torpesubm"+i+".png");
        }
        sea = new ImageIcon[4];//画背景
        for (int i = 0; i <sea.length ; i++) {
            sea[i] = new ImageIcon("img/sea/sea"+i+".png");
        }
        bossleft = new ImageIcon[6];
        for (int i = 0; i <bossleft.length ; i++) {
            bossleft[i] = new ImageIcon("img/boss/bossleft"+i+".png");
        }
        bossright = new ImageIcon[6];
        for (int i = 0; i <bossright.length ; i++) {
            bossright[i] = new ImageIcon("img/boss/bossright"+i+".png");
        }
        rewardsubm = new ImageIcon[6];//天使(奖励潜艇)图
        for (int i = 0; i <rewardsubm.length ; i++) {
            rewardsubm[i] = new ImageIcon("img/rewardsubm/rewardsubm"+i+".png");
        }
        coin = new ImageIcon[2];//金币图
        for (int i = 0; i <coin.length ; i++) {
            coin[i] = new ImageIcon("img/coin"+(i+1)+".png");
        }
        bossbomb = new ImageIcon("img/bossbomb/bossbomb.png");//boss子弹1图
        bossbombnum = new ImageIcon[2];//boss子弹2图
        for (int i = 0; i <bossbombnum.length ; i++) {
            bossbombnum[i] = new ImageIcon("img/bossbomb/bossbomb"+i+".png");
        }
        witchone = new ImageIcon[8];//魔女1图
        for (int i = 0; i <witchone.length ; i++) {
            witchone[i] = new ImageIcon("img/witchone/witchone"+i+".png");
        }
        witchtwo = new ImageIcon[6];//魔女2图
        for (int i = 0; i <witchtwo.length ; i++) {
            witchtwo[i] = new ImageIcon("img/witchtwo/witchtwo"+i+".png");
        }
        ult = new ImageIcon[17];//大招图
        for (int i = 0; i <ult.length ; i++) {
            ult[i] = new ImageIcon("img/ult/ult"+i+".png");
        }
        boommap = new ImageIcon[10];//爆炸图
        for (int i = 0; i <boommap.length ; i++) {
            boommap[i] = new ImageIcon("img/boom/boom"+i+".png");
        }
        bossboom = new ImageIcon[8];//boss爆炸图
        for (int i = 0; i <bossboom.length ; i++) {
            bossboom[i] = new ImageIcon("img/bossboom/bossboom"+i+".png");
        }
        shieldwitch = new ImageIcon[26];//护盾魔女图
        for (int i = 0; i <shieldwitch.length ; i++) {
            shieldwitch[i] = new ImageIcon("img/shieldwitch/shieldsing"+i+".png");
        }
        shield = new ImageIcon[8];//护盾图
        for (int i = 0; i <shield.length ; i++) {
            shield[i] = new ImageIcon("img/shield/shield"+i+".png");
        }


        try {
            coinsound = JApplet.newAudioClip(new File("sound/coinsound.wav").toURI().toURL());//金币声
            bgm = JApplet.newAudioClip(new File("sound/bgm.wav").toURI().toURL());//背景音乐
            bombsound = JApplet.newAudioClip(new File("sound/bombsound.wav").toURI().toURL());//战舰炸弹
            bbsound = JApplet.newAudioClip(new File("sound/bbsound.wav").toURI().toURL());
            boom = JApplet.newAudioClip(new File("sound/boom.wav").toURI().toURL());
            gameoversound = JApplet.newAudioClip(new File("sound/gameoversound.wav").toURI().toURL());
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) { //测试
        System.out.println(bomb.getImageLoadStatus());
        System.out.println(mine.getImageLoadStatus());
        System.out.println(gameover.getImageLoadStatus());
        System.out.println(bossbomb.getImageLoadStatus());
        System.out.println(bosshp.getImageLoadStatus());
        for (ImageIcon ms : minesubm){
            System.out.println(ms.getImageLoadStatus());
        }
        for (ImageIcon os : obsersubm){
            System.out.println(os.getImageLoadStatus());
        }
        for (ImageIcon ts : torpesubm){
            System.out.println(ts.getImageLoadStatus());
        }
        for (ImageIcon s : sea){
            System.out.println(s.getImageLoadStatus());
        }

        for (ImageIcon rs : rewardsubm){
            System.out.println(rs.getImageLoadStatus());
        }
        for (ImageIcon ic : coin){
            System.out.println(ic.getImageLoadStatus());
        }
        for (ImageIcon bb : bossbombnum){
            System.out.println(bb.getImageLoadStatus());
        }
        for (ImageIcon wo : witchone){
            System.out.println(wo.getImageLoadStatus());
        }
        for (ImageIcon wo : witchtwo){
            System.out.println(wo.getImageLoadStatus());
        }
        for (ImageIcon u : ult){
            System.out.println(u.getImageLoadStatus());
        }
        for (ImageIcon bm : boommap){
            System.out.println(bm.getImageLoadStatus());
        }
        for (ImageIcon bbm : bossboom){
            System.out.println(bbm.getImageLoadStatus());
        }
        for (ImageIcon bl : bossleft){
            System.out.println(bl.getImageLoadStatus());
        }
        for (ImageIcon br : bossright){
            System.out.println(br.getImageLoadStatus());
        }
        for (ImageIcon sw : shieldwitch){
            System.out.println(sw.getImageLoadStatus());
        }
        for (ImageIcon s1 : shield){
            System.out.println(s1.getImageLoadStatus());
        }

    }
}
